<template>
  <div class="ma-content-block lg:flex justify-between p-4">
    <!-- CRUD 组件 -->
    <ma-crud :options="options" :columns="columns" ref="crudRef">
    </ma-crud>
  </div>
</template>
<script setup>
import { ref, reactive } from 'vue'
import secureRecognizeInfo from '@/api/secure/secureRecognizeInfo'
import { Message } from '@arco-design/web-vue'
import tool from '@/utils/tool'
import * as common from '@/utils/common'

const crudRef = ref()


const numberOperation = (newValue, id, numberName) => {
  secureRecognizeInfo.numberOperation({ id, numberName, numberValue: newValue }).then( res => {
    res.success && Message.success(res.message)
  }).catch( e => { console.log(e) } )
}

const switchStatus = (statusValue, id, statusName) => {
  secureRecognizeInfo.changeStatus({ id, statusName, statusValue }).then( res => {
    res.success && Message.success(res.message)
  }).catch( e => { console.log(e) } )
}


const options = reactive({
  id: 'flyos_secure_recognize_info',
  rowSelection: {
    showCheckedAll: true
  },
  pk: 'id',
  operationColumn: true,
  operationWidth: 160,
  formOption: {
    viewType: 'modal',
    width: 600
  },
  api: secureRecognizeInfo.getList,
  recycleApi: secureRecognizeInfo.getRecycleList,
  add: {
    show: true,
    api: secureRecognizeInfo.save,
    auth: ['secure:recognizeInfo:save']
  },
  edit: {
    show: true,
    api: secureRecognizeInfo.update,
    auth: ['secure:recognizeInfo:update']
  },
  delete: {
    show: true,
    api: secureRecognizeInfo.deletes,
    auth: ['secure:recognizeInfo:delete'],
    realApi: secureRecognizeInfo.realDeletes,
    realAuth: ['secure:recognizeInfo:realDeletes']
  },
  recovery: {
    show: true,
    api: secureRecognizeInfo.recoverys,
    auth: ['secure:recognizeInfo:recovery']
  },
  import: {
    show: true,
    url: 'secure/recognizeInfo/import',
    templateUrl: 'secure/recognizeInfo/downloadTemplate',
    auth: ['secure:recognizeInfo:import']
  },
  export: {
    show: true,
    url: 'secure/recognizeInfo/export',
    auth: ['secure:recognizeInfo:export']
  }
})

const columns = reactive([
  {
    title: "ID",
    dataIndex: "id",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    commonRules: {
      required: true,
      message: "请输入ID"
    }
  },
  {
    title: "人员ID",
    dataIndex: "user_id",
    formType: "input",
    search: true
  },
  {
    title: "坐标和半径",
    dataIndex: "pupils",
    formType: "input",
    hide: true
  },
  {
    title: "识别到的人脸性别",
    dataIndex: "genderlist",
    formType: "select",
    search: true,
    multiple: false,
    dict: {
      data: [
        {
          label: "女性",
          value: "0"
        },
        {
          label: "男性",
          value: "1"
        }
      ],
      translation: true
    }
  },
  {
    title: "人脸识别的表情结果",
    dataIndex: "expressions",
    formType: "select",
    search: true,
    multiple: false,
    dict: {
      data: [
        {
          label: "中性",
          value: "0"
        },
        {
          label: "微笑",
          value: "1"
        }
      ],
      translation: true
    }
  },
  {
    title: "检测出来的人脸个数",
    dataIndex: "facecount",
    formType: "input",
    search: true
  },
  {
    title: "人脸的特征点定位结果",
    dataIndex: "landmarks",
    formType: "input",
    hide: true
  },
  {
    title: "人脸检测的特征点数目",
    dataIndex: "landmarkcount",
    formType: "input",
    search: true
  },
  {
    title: "人脸质量情况",
    dataIndex: "qualities",
    formType: "input",
    hide: true
  },
  {
    title: "颜值分数",
    dataIndex: "beautylist",
    formType: "input",
    search: true
  },
  {
    title: "人脸是否佩戴帽子",
    dataIndex: "hatlist",
    formType: "select",
    search: true,
    multiple: false,
    dict: {
      data: [
        {
          label: "无帽子",
          value: "0"
        },
        {
          label: "有帽子",
          value: "1"
        }
      ],
      translation: true
    }
  },
  {
    title: "返回人脸检测的概率",
    dataIndex: "faceprobabilitylist",
    formType: "input",
    search: true
  },
  {
    title: "人脸是否佩戴眼镜",
    dataIndex: "glasses",
    formType: "select",
    search: true,
    multiple: false,
    dict: {
      data: [
        {
          label: "不戴眼睛",
          value: "0"
        },
        {
          label: "佩戴普通眼镜",
          value: "1"
        },
        {
          label: "佩戴墨镜",
          value: "2"
        }
      ],
      translation: true
    }
  },
  {
    title: "返回人脸矩形框",
    dataIndex: "facerectangles",
    formType: "input",
    hide: true
  },
  {
    title: "返回人脸姿态",
    dataIndex: "poselist",
    formType: "input",
    hide: true
  },
  {
    title: "图片中人脸年龄",
    dataIndex: "agelist",
    formType: "input",
    search: true
  },
  {
    title: "人脸识别返回的特征维度",
    dataIndex: "densefeaturelength",
    formType: "input",
    search: true
  },
  {
    title: "人脸是否佩戴口罩",
    dataIndex: "masks",
    formType: "select",
    search: true,
    multiple: false,
    dict: {
      data: [
        {
          label: "未佩戴口罩",
          value: "0"
        },
        {
          label: "佩戴口罩",
          value: "1"
        },
        {
          label: "未正确佩戴口罩",
          value: "2"
        }
      ],
      translation: true
    }
  },
  {
    title: "创建者",
    dataIndex: "created_by",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "更新者",
    dataIndex: "updated_by",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "创建时间",
    dataIndex: "created_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "更新时间",
    dataIndex: "updated_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "删除时间",
    dataIndex: "deleted_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  }
])
</script>
<script> export default { name: 'secure:recognizeInfo' } </script>